package com.indexingsystem.boss.entity;

import java.io.Serializable;
import java.util.Date;

import com.alibaba.fastjson.annotation.JSONField;

public class Pusers implements Serializable {

	// 0:禁止登录
	// public static final Long _0 = new Long( 0 );
	// 1:有效
	// public static final Long _1 = new Long( 1 );

	/**
	 * 
	 */
	private static final long	serialVersionUID	= -7829919497399671339L;

	private Boolean				locked				= Boolean.FALSE;

	private String				userId;

	private String				userName;

	private String				displayName;

	private String				password;

	private String				email;

	private String				userFolder;

	private String				portrait;

	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date				createDate;

	private Integer				status;

	private Integer				isActivate;

	private Integer				isAutonym;

	private Integer				isSuper;

	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date				updatePasswordDate;

	private String				registerSource;

	private String				activateKey;

	private String				activateLastDate;

	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date				lastLoginDate;

	private String				salt;											// 加密密码的盐

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId == null ? null : userId.trim();
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName == null ? null : userName.trim();
	}

	public String getDisplayName() {
		return displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName == null ? null : displayName.trim();
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password == null ? null : password.trim();
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email == null ? null : email.trim();
	}

	public String getUserFolder() {
		return userFolder;
	}

	public void setUserFolder(String userFolder) {
		this.userFolder = userFolder == null ? null : userFolder.trim();
	}

	public String getPortrait() {
		return portrait;
	}

	public void setPortrait(String portrait) {
		this.portrait = portrait == null ? null : portrait.trim();
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getIsActivate() {
		return isActivate;
	}

	public void setIsActivate(Integer isActivate) {
		this.isActivate = isActivate;
	}

	public Integer getIsAutonym() {
		return isAutonym;
	}

	public void setIsAutonym(Integer isAutonym) {
		this.isAutonym = isAutonym;
	}

	public Integer getIsSuper() {
		return isSuper;
	}

	public void setIsSuper(Integer isSuper) {
		this.isSuper = isSuper;
	}

	public Date getUpdatePasswordDate() {
		return updatePasswordDate;
	}

	public void setUpdatePasswordDate(Date updatePasswordDate) {
		this.updatePasswordDate = updatePasswordDate;
	}

	public String getRegisterSource() {
		return registerSource;
	}

	public void setRegisterSource(String registerSource) {
		this.registerSource = registerSource == null ? null : registerSource.trim();
	}

	public String getActivateKey() {
		return activateKey;
	}

	public void setActivateKey(String activateKey) {
		this.activateKey = activateKey == null ? null : activateKey.trim();
	}

	public String getActivateLastDate() {
		return activateLastDate;
	}

	public void setActivateLastDate(String activateLastDate) {
		this.activateLastDate = activateLastDate == null ? null : activateLastDate.trim();
	}

	public Date getLastLoginDate() {
		return lastLoginDate;
	}

	public void setLastLoginDate(Date lastLoginDate) {
		this.lastLoginDate = lastLoginDate;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getCredentialsSalt() {
		return userName + salt;
	}

	public Boolean getLocked() {
		return locked;
	}

	public void setLocked(Boolean locked) {
		this.locked = locked;
	}

	public Pusers(String userName, String password) {
		this.userName = userName;
		this.password = password;
	}

	

	public Pusers(Pusers pusers) {
		super();
		this.locked = pusers.locked;
		this.userId = pusers.userId;
		this.userName = pusers.userName;
		this.displayName = pusers.displayName;
		this.password = pusers.password;
		this.email = pusers.email;
		this.userFolder = pusers.userFolder;
		this.portrait = pusers.portrait;
		this.createDate = pusers.createDate;
		this.status = pusers.status;
		this.isActivate = pusers.isActivate;
		this.isAutonym = pusers.isAutonym;
		this.isSuper = pusers.isSuper;
		this.updatePasswordDate = pusers.updatePasswordDate;
		this.registerSource = pusers.registerSource;
		this.activateKey = pusers.activateKey;
		this.activateLastDate = pusers.activateLastDate;
		this.lastLoginDate = pusers.lastLoginDate;
		this.salt = pusers.salt;
	}

	public Pusers(Boolean locked, String userId, String userName, String displayName, String password, String email, String userFolder,
			String portrait, Date createDate, Integer status, Integer isActivate, Integer isAutonym, Integer isSuper, Date updatePasswordDate,
			String registerSource, String activateKey, String activateLastDate, Date lastLoginDate, String salt) {
		super();
		this.locked = locked;
		this.userId = userId;
		this.userName = userName;
		this.displayName = displayName;
		this.password = password;
		this.email = email;
		this.userFolder = userFolder;
		this.portrait = portrait;
		this.createDate = createDate;
		this.status = status;
		this.isActivate = isActivate;
		this.isAutonym = isAutonym;
		this.isSuper = isSuper;
		this.updatePasswordDate = updatePasswordDate;
		this.registerSource = registerSource;
		this.activateKey = activateKey;
		this.activateLastDate = activateLastDate;
		this.lastLoginDate = lastLoginDate;
		this.salt = salt;
	}

	public Pusers() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public String toString() {
		return "Pusers [locked=" + locked + ", userId=" + userId + ", userName=" + userName + ", displayName=" + displayName + ", password="
				+ password + ", email=" + email + ", userFolder=" + userFolder + ", portrait=" + portrait + ", createDate=" + createDate
				+ ", status=" + status + ", isActivate=" + isActivate + ", isAutonym=" + isAutonym + ", isSuper=" + isSuper + ", updatePasswordDate="
				+ updatePasswordDate + ", registerSource=" + registerSource + ", activateKey=" + activateKey + ", activateLastDate="
				+ activateLastDate + ", lastLoginDate=" + lastLoginDate + ", salt=" + salt + "]";
	}
}